home *** CD-ROM | disk | FTP | other *** search
/ SIGGRAPH 2002 Course Notes / SIGGRAPH 2002 - Course Notes - Disc 1.iso / pc / notes / 16 / supplemental-material / Gritz / bake.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-05  |  628 b   |  20 lines

  1. /* bake.h - helper macro for texture baking */
  2.  
  3. #define BAKE(name,s,t,func,dest)                    \
  4. {                                    \
  5.     string objname = "";                        \
  6.     attribute ("identifier:name", objname);                \
  7.     string passname = "";                        \
  8.     option ("user:pass", passname);                    \
  9.     float bakingpass = match ("bake", passname);            \
  10.     color foo;                                \
  11.     if (bakingpass != 0) {                        \
  12.     dest = func(s,t);                        \
  13.     string bakefilename = concat (objname, ".", bakename, ".bake");    \
  14.     bake (bakefilename, s, t, dest);                \
  15.     } else {                                \
  16.     string filename = concat (objname, ".", bakename, ".tx");    \
  17.     dest = texture (filename, s, t);                \
  18.     }
  19. }
  20.